$(document).ready(function(){
	$('.edit_club_cat').click(function(){
		var id = $(this).attr('rel');
		var div = $('#club_cat_title_'+ id);
		var form = $('#club_cat_edit_'+ id);
		
		div.hide();
		form.show();
		
		return false;
	});
	
	$('.cancel').live('click', function(){
		var id = $(this).attr('rel');
		var div = $('#club_cat_title_'+ id);
		var form = $('#club_cat_edit_'+ id);
		
		form.hide();
		div.show();
	});
	
	$('.club_cat_edit').live('submit', function(){
		form = $(this);
		td = form.closest('td');
		$.ajax({
			"url": form.attr('action'),
			"method": form.attr('method'),
			"data": form.serialize(),
			"dataType": "html",
			"beforeSend": function(){
				form.addClass('load');
			},
			"success": function(html){
				form.removeClass('load');
				td.html(html);
			}
		});
		
		return false;
	});
});